<include file="Public/min-header" />
<link href="__PUBLIC__/plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<script src="__PUBLIC__/plugins/daterangepicker/moment.min.js" type="text/javascript"></script>
<script src="__PUBLIC__/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<div class="wrapper">
    <include file="Public/breadcrumb"/>
    <section class="content ">
        <!-- Main content -->
        <div class="container-fluid">
            <!--<div class="pull-right">-->
                <!--<a href="javascript:history.go(-1)" data-toggle="tooltip" title="" class="btn btn-default" data-original-title="返回"><i class="fa fa-reply"></i></a>-->
            <!--</div>-->
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><i class="fa fa-list"></i> 每日签到</h3>
                </div>
                <div class="panel-body ">   
                    <!--表单数据-->
                    <form action="" id="coupon_form" method="post">
                        <!--通用信息-->
                    <div class="tab-content col-md-10">
                        <div class="tab-pane active" id="tab_tongyong">                           
                            <table class="table table-bordered">
                                <tbody>
                                <tr>
			                        <td>是否启用每日签到:</td>
			                        <td id="order-status">
			                         	<input name="sign_type" type="radio" value="0" <if condition="$sign['sign_type'] eq 0">checked</if> >启用
			                            <input name="sign_type" type="radio" value="1" <if condition="$sign['sign_type'] eq 1">checked</if> >禁止
			                        </td>
			                    </tr>

								<tr>
									<td class="col-sm-2">每日签到奖励：</td>
									<td class="col-sm-4">
										<input class="col-sm-8" type="text" value="{$sign['sign_points']}" class="form-control" id="name" name="sign_points" >
										<span  class="col-sm-1" style="color: #5F718B;font-size: 13px">积分</span>
									</td>

								</tr>
								<volist name="sign['signs']" id="v"  key="k">
									<tr>
										<td class="rule col-sm-2" style="color:#F00">规则：</td>
										<td class="col-sm-4">
											<div style="height: 30px">
												<span class="col-sm-2">连续签到：</span>
												<input class="col-sm-6" style="height: 30px" type="text" value="{$key}" class="form-control" id="money" name="sign[]"  onpaste="this.value=this.value.replace(/[^\d.]/g,'')" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')"/>
												<span class="col-sm-1" style="color: #5F718B;font-size: 13px">天</span>
											</div>

											<br>
											<div style=" height: 30px">
												<span class="col-sm-2">奖励：</span>
												<input class="col-sm-6" style="height: 30px" type="text" value="{$v}" class="form-control" id="money" name="score[]"  onpaste="this.value=this.value.replace(/[^\d.]/g,'')" onkeyup="this.value=this.value.replace(/[^\d.]/g,'')"/>
												<span class="col-sm-1" style="color: #5F718B;font-size: 13px">积分</span>
											</div>
										</td>

									</tr>
								</volist>

                                </tbody>

                            </table>
							<input type="hidden" name="id" value="{$sign['id']}">
							<span style="float: right;margin-right: 10px" class="text-right"><input class="btn btn-primary" type="button" onclick="coupon_submit()" value="保存"></span>

						</div>
                    </div>              
			    	</form>
                </div>
            </div>
        </div>
    </section>
</div>

<script>


    $(function () {
        $('#addNew').click(function () {

          var p= $(" tbody > tr:last-child ");

            if($('.rule').length >=5)
            {
                alert('一次性最多只能制定5个规则');
            }else{
                p.after(p.clone());
            }
        });
        $('#delOne').click(function () {
            var p= $(" tbody > tr:last-child ");
            if($('.rule').length <= 1)
            {
                alert('你难道不想留一个吗?');
            }else{
                p.remove();
            }
        });
    })

    function coupon_submit(){
        if($('input[name=sign_points]').val() == ''){
            layer.msg('每日签到积分不能为空！', {icon: 2,time: 1000});
            return false;
        }
        $('#coupon_form').submit();
    }

$('input[type="radio"]').click(function(){
    if($(this).val() == 0){
    	$('.timed').hide();
    }else{
    	$('.timed').show();
    }
})


$(function(){
    data_pick('send_start_time');
    data_pick('send_end_time');
    data_pick('use_start_time');
    data_pick('use_end_time');
    $('input[type="radio"]:checked').trigger('click');
})
    
function data_pick(id){
    var myDate = new Date();
    $('#'+id).daterangepicker({
    	format:"YYYY-MM-DD HH:mm:ss",
        singleDatePicker: true,
        showDropdowns: true,
        minDate:myDate.getFullYear()+'-'+myDate.getMonth()+'-'+myDate.getDate(),
        maxDate:'2030-01-01',
		timePicker : true, //是否显示小时和分钟  
        timePickerIncrement:1,//time选择递增数
		timePicker12Hour : false, //是否使用12小时制来显示时间 		
        locale : {
            applyLabel : '确定',
            cancelLabel : '取消',
            fromLabel : '起始时间',
            toLabel : '结束时间',
            customRangeLabel : '自定义',
            daysOfWeek : [ '日', '一', '二', '三', '四', '五', '六' ],
            monthNames : [ '一月', '二月', '三月', '四月', '五月', '六月','七月', '八月', '九月', '十月', '十一月', '十二月' ],
            firstDay : 1
        }
    });
}
</script>
</body>
</html>